#!/usr/bin/env bash

# ----------------------------------------------------------------------
# Filename	:  06-gn-qd_004_drive.sh
# Version	:  2.0
# Date		:  2024/02/17
# Author	:  yaoxiyao
# Email		:  yaoxiyao@kylinsec.com.cn
# Function	:  GN-QD_004设备状态查询
# Out		:
#              0 => TPASS
#              1 => TFAIL
#              other=> TCONF
# ----------------------------------------------------------------------

# 测试主题
Title_Env_LTFLIB="GN-QD_004设备状态查询"

## TODO : 个性化,初始化
#   Out : 0=>TPASS
#         1=>TFAIL
#         2=>TCONF
TestInit_LTFLIB() {
    return $TPASS
}

## TODO : 清理函数
#   Out : 0=>TPASS
#         1=>TFAIL
#         2=>TCONF
TestClean_LTFLIB() {
    return $TPASS
}

## TODO : 测试用例集
#   Out : 0=>TPASS
#         1=>TFAIL
#         2=>TCONF
Testsuite_LTFLIB() {
    testcase_1
    return $TPASS
}

## TODO : 文件命名规范测试
testcase_1() {
    local lspci_id=($(lspci -k | awk '{print $1}' | grep ":[0-9]"))
    for i in "${lspci_id[@]}"; do
        lspci -vv -s "${i}" | tail -n 3
        CommRetParse_LTFLIB "lspci -vv -s ${i}|tail -n 3"
    done
    lsusb
    CommRetParse_LTFLIB "lsusb"
}

#----------------------------------------------#

source "${LIB_LTFLIB}"
Main_LTFLIB $@
